// 遮罩
const screenMask = document.querySelector(".screenMask")
// 清除缓存按钮
const ClearCacheBtn = document.querySelector(".option ul li .ClearCacheBtn")
// 退出按钮
const Exit = document.querySelector(".exit .Exit")
// 清除缓存盒子
const clearCacheHint = document.querySelector(".clearCacheHint")
// 退出登录盒子
const signOutHint = document.querySelector(".signOutHint")
// 取消按钮
const cancel = document.querySelectorAll(".floatBox .btn .cancel")
Exit.addEventListener("click", function () {
	signOutHint.style.opacity = 1
	screenMask.style.opacity = 1
	signOutHint.style.zIndex = 2
	screenMask.style.zIndex = 1
})
ClearCacheBtn.addEventListener("click", function () {
	clearCacheHint.style.opacity = 1
	screenMask.style.opacity = 1
	clearCacheHint.style.zIndex = 2
	screenMask.style.zIndex = 1
})
cancel.forEach(function (item) {
	item.addEventListener("click", function () {
		closeWindow()
	})
})

function closeWindow() {
	signOutHint.style.opacity = 0
	signOutHint.style.zIndex = -1
	clearCacheHint.style.opacity = 0
	clearCacheHint.style.zIndex = -1
	screenMask.style.opacity = 0
	screenMask.style.zIndex = -1
}

const topPresetBack = document.querySelector(".topPreset a")
topPresetBack.addEventListener("click", function () {
	history.back()
})

const disableBox = document.querySelector(".option .disableBox")
const floatingTips = document.querySelector(".floatingTips")
clearYes.addEventListener("touchstart", function () {
	const TipsActiveClass = document.querySelector(".TipsActiveClass")
	!TipsActiveClass && floatingTips.classList.add("TipsActiveClass")
	setTimeout(function () {
		floatingTips.classList.remove("TipsActiveClass")
	}, 2800)
	closeWindow()
	disableBox.style.height = 61 / 37.5 + "rem"
	ClearCacheBtn.style.color = "#818181"
})

signOutYes.addEventListener("touchstart", function () {
	closeWindow()
	location.href = "../module01/phoneLogin.html"
})

const changePassword = document.querySelectorAll(
	".option ul li .changePassword"
)
changePassword.forEach(function (item) {
	item.addEventListener("touchstart", function () {
		location.href = "../module03/HTML/change-password.html"
	})
})
changePhone.addEventListener("touchstart", function () {
	location.href = "../module03/HTML/change-phone copy.html"
})
notification.addEventListener("touchstart", function () {
	location.href = "../module03/HTML/message-inform-setting.html"
})
